<%@ page language="java" import="java.util.*" pageEncoding="utf-8"
	isELIgnored="false"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%
    String path = request.getContextPath();
			String basePath = request.getScheme() + "://"
					+ request.getServerName() + ":" + request.getServerPort()
					+ path + "/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>角色管理</title>

<script type="text/javascript" src="<%=request.getContextPath()%>/easyui/jquery.min.js"></script>
<script type="text/javascript" src="<%=request.getContextPath()%>/easyui/jquery.easyui.min.js"></script>
<script type="text/javascript" src="<%=request.getContextPath()%>/easyui/locale/easyui-lang-zh_CN.js"></script>
<link href="<%=request.getContextPath()%>/easyui/themes/default/easyui.css" rel="stylesheet" type="text/css" />
<link href="<%=request.getContextPath()%>/easyui/themes/icon.css" rel="stylesheet" type="text/css" />
<link href="<%=request.getContextPath()%>/css/style.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="<%=request.getContextPath()%>/js/jquery-2.1.4.min.js"></script>
<link rel="stylesheet" href="<%=request.getContextPath()%>/css/jPages.css">
<link rel="stylesheet" href="<%=request.getContextPath()%>/css/animate.css">
<script src="<%=request.getContextPath()%>/js/jquery-1.8.2.min.js"></script>
<script src="<%=request.getContextPath()%>/js/jPages.js"></script>
<style >
   /*  .toolbar1 table{
    width: 552px;
    } */
     input{
       border: solid 1px #d7a372;
    }
</style>
<script type="text/javascript">
$(function(){  
	$("div.holder").jPages({  
	  containerID : "item", 
	  first:"首页", 
	  previous : "上一页",  
	  next : "下一页",
	  last:"尾页",  
	  perPage : 10,  
	  //delay : 100,
	  //动画效果
	  //animation:"bounceInLeft"
	});  
	
	$("#selectAll").click(function() {
		if($("#selectAll").is(":checked")){
			$("input[name=select]").prop("checked","checked");
		}else{
			$("input[name=select]").attr("checked",false);
		}
	});
	
	$(".delete").click(function() {
		var str = new Array();var str1 = new Array();
		$("input[name=select]:checked").each(function(index,domEle){
			var idd = $(domEle).parent().parent().find("input[name=role_id]").val();	
			var role_name = $(domEle).parent().parent().find("input[name=role_name]").val();	
			str.push(idd);str1.push(role_name);
	    }); 
	    if(str == null || str == ""){
	    	alert("请选择要删除的角色！");
	    	return;
	    }
// 	    $(".tip").fadeIn(500);
		var flag = confirm("是否确认删除?");
		if(flag){
			str = str.join(",");
	    	str1 = str1.join(",");
	    	if(str1.indexOf("超级管理员") == 0 || str1 == "超级管理员"){
	    		alert("超级管理员角色不能删除。");
	    		$(".tip").fadeOut(100);
	    		return ;
	    	}else{
	    		  window.location.href="/htx-backer/sysUser/deleteRole?id="+str;
	    	}
		}
// 	    $(".sure").click(function(){
// 	    	str = str.join(",");
// 	    	str1 = str1.join(",");
// 	    	if(str1.indexOf("超级管理员") > 0){
// 	    		alert("超级管理员角色不能删除。");
// 	    		$(".tip").fadeOut(100);
// 	    		return ;
// 	    	}else{
// 	    		  window.location.href="/htx-backer/sysUser/deleteRole?id="+str;
// 	    	}
// 		});
	});
 });  
</script>
<script type="text/javascript">
$(document).ready(function(){
  $(".click").click(function(){
 	 $(".tip").fadeIn(200);
  });
  
  $(".cancel").click(function(){
	  $(".tip").fadeOut(100);
  });
});
</script>
</head>

<body>
	<div class="place">
		<span>位置：</span>
		<ul class="placeul">
			<li><ema href="javascript:void">首页</em></li>
			<li><ema href="javascript:void">基础管理 </em></li>
			<li><ema href="javascript:void">权限管理</em></li>
		</ul>
	</div>
	<div class="rightinfo">
	  
	  <div >
				<table>
					<form action="<%=request.getContextPath()%>/sysUser/sysRoleList" method="post" name="serch">
						<tr>
							<td class="zi"><span>添加时间：</span></td>
							<td><input type="date" name="startTime" />-<input type="date" name="endTime" /></td>
							<td class="zi" ><span>&nbsp;&nbsp;&nbsp;&nbsp;状态：</span></td>
							<td><select name="status">
									<option selected="selected" value="0">请选择状态</option>
									<option value="1">启用</option>
									<option value="2">禁用</option>
							</select></td>
							<td class="zi" ><span>&nbsp;&nbsp;&nbsp;&nbsp;角色名称：</span></td>
							<td><input type="text" name="roleName"  /></td>
							<td><input type="submit" value="查询" style="background-color: #dca571; padding: 7px; border-radius: 5%;margin-left:2px;height: 35px;" class="button" /></td>
						</tr>
					</form>
				</table>
			</div>
	
		<div class="tools">
			<ul class="toolbar">
				<li class="delete"><span><img src="<%=request.getContextPath()%>/images/t03.png" /></span>删除</li>
				<a href="<%=request.getContextPath()%>/ui/role/add_sysRole.jsp"><li><span><img src="<%=request.getContextPath()%>/images/t01.png" /></span>添加</li></a>
			   <%-- <li class="imports"><span><img src="<%=request.getContextPath()%>/images/ticon.png" style='width: 24px; height: 24px;'/></span>导入</li> --%>
			</ul>
		</div>
		<%-- <form action="<%=basePath%>/importKnow" method="post" style="display:none"id="fileForm" enctype="multipart/form-data">
	    &nbsp;&nbsp;&nbsp;<label style="color:red">${ReturnData.msg}</label>
	    <hr>            
	    <input  type="file" name="excelFile" id="excelFile"   onchange="javascript:$('#fileForm').submit();" class="form-control">   
      </form> --%>
		<table class="tablelist">
			<thead>
				<tr>
					<th><input type="checkbox" value="" id="selectAll" /></th>
					<th>角色名称</th>
					<th>角色权限</th>
					<th>添加时间</th>
					<th>状态</th>
					<th>操作</th>
				</tr>
			</thead>
			<tbody class="tb" id="item">
				<c:forEach items="${sysRoleList}" var="data">
					<tr>
						<td><input name="select" type="checkbox" value="" /></td>
						<input type="hidden"  name="role_id"value="${data.role_id}"></input>
						<input type="hidden"  name="role_name"value="${data.role_name}"></input>
						<td>${data.role_name}</td>
						<td style="width:700px;">${data.action_name}</td>
						<td>${data.createTime}</td>
						<td> ${data.status} </td>
						<td>
							<a href="<%=request.getContextPath()%>/sysUser/selectSysRoleInfo?role_id=${data.role_id}" style="cursor:pointer;color:blue;font-size:14px;font-weight:bold;">编辑</a>
						</td>
					</tr>
				</c:forEach>
			</tbody>
		</table>
		<div style="clear:both;"></div>
		<!-- 分页的页码 -->
		<div class="holder"></div>
		共${nums}条记录
		<div class="tip">
			<div class="tiptop">
				<span>提示信息</span>
			</div>
			<div class="tipinfo">
				<span><img src="<%=request.getContextPath()%>/images/ticon.png" /></span>
				<div class="tipright">
					<p>是否确认删除 ？</p>
					<cite>如果是请点击确定按钮 ，否则请点取消。</cite>
				</div>
			</div>
			<div class="tipbtn">
				<input name="" type="button" class="sure" value="确定"/>&nbsp;<input name="" type="button" class="cancel" value="取消" />
			</div>
		</div>
	</div>
	<script type="text/javascript">
		$('.tablelist tbody tr:odd').addClass('odd');
	</script>
	
</body>
</html>
